package com.dingding.javabasic.线程池;

import java.util.Random;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;

public class Solution {

    ThreadPoolExecutor executor = new ThreadPoolExecutor(
            5,
            10,
            1000,
            TimeUnit.SECONDS,
            new ArrayBlockingQueue<>(100),
            new ThreadPoolExecutor.CallerRunsPolicy()
    );

    public static void main(String[] args) {
        AtomicInteger i = new AtomicInteger(0);
        Runnable runnable = () ->{
            i.incrementAndGet();
        };
        Solution solution = new Solution();
        solution.executor.execute(runnable);
        System.out.println(i.get());

        Runnable r = () -> {};
    }
}
